<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>{{msg}}</h1>
    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>

        const app =Vue.createApp({
            data(){
                return{
                    list:["你好","亲爱的用户","欢迎进入"],
                    msg:""
                }
            },
            //此处用mounted也可以
            created(){
                this.showData();
            },
            methods:{
                showData(){
                    let i = 0 ;
                    //setInterval() 方法会不停地调用函数，直到 clearInterval() 被调用或窗口被关闭
                    let t = setInterval(() =>{
                        this.msg = this.list[i];
                        i++;
                        if( i === 3){
                            clearInterval(t)
                        }
                    },500)
                }
            },
            
        })

        app.mount("#app")
    </script>
</body>
</html>